<template>
  <div>
    <el-form-item :prop="item.name || ''" :label="item.label" v-bind="item.formItemProps || {}" ref="el-form-item">
      <el-input ref="input" type="text" v-model="mvalue" v-bind="opt" @keyup.enter.native="eventTrigger( 'onEnter', $event)"></el-input>
    </el-form-item>
  </div>
</template>

<script>
  import { objectAssign } from "../../utils/common";
  import StrAllMixin from "../validMixins/StrAllMixin";
  import NumberAllMixin from "../validMixins/NumberAllMixin";
  import Required from "../validMixins/Required";
  import EventTrigger from "../plugsMixins/EventTrigger";

  export default {
    name: "PopoText",
    props: {
      value: { type: String },
      item: { type: Object },
      formData: { type: Object },
    },
    mixins: [EventTrigger, StrAllMixin, NumberAllMixin, Required],
    data() {
      return {
        mvalue: this.value,
        opt: {},
      };
    },
    watch: {
      mvalue(val) {
        this.$emit("input", val);
      },
    },
    created() {
      // console.log( "input", this);
      var opt = objectAssign(
        {
          showPassword: this.item.showPassword === undefined ? false : this.item.showPassword,
          autocomplete: this.item.autocomplete === undefined ? "off" : this.item.autocomplete,
        },
        this.item.props
      );
      this.opt = opt;
    },
    methods: {
    },
  };
</script>
